package br.com.fatec.cqr.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;

public class ToolBarInferior extends JToolBar {

	public ToolBarInferior() {
		final Action action = new Action();
		this.setBackground(new Color(240, 255, 255));

		Toolkit size = Toolkit.getDefaultToolkit();

		int width = size.getScreenSize().width;

		this.setBackground(new Color(240, 255, 255));
		this.setPreferredSize(new Dimension(width, 25));

		String source = "resources/";
		JButton btnOpenFile = new JButton(" Open File");
		btnOpenFile.setToolTipText("Open File");
		btnOpenFile.setBackground(new Color(240, 255, 255));
		btnOpenFile.setIcon(new ImageIcon(Tela.class
				.getResource(source + "Open Project 16x16.png")));
		btnOpenFile.setPreferredSize(new Dimension(111, 21));
		btnOpenFile.addActionListener(action);
		btnOpenFile.setFont(new Font("Arial", Font.ITALIC, 12));
		this.add(btnOpenFile);

		JButton btnSave = new JButton("Save");
		btnSave.setToolTipText("Save");
		btnSave.setFont(new Font("Arial", Font.ITALIC, 12));
		btnSave.setBackground(new Color(240, 255, 255));
		btnSave.setIcon(new ImageIcon(Tela.class.getResource(source
				+ "Save 16x16.png")));
		btnSave.setPreferredSize(new Dimension(42, 21));
		btnSave.addActionListener(action);
		this.add(btnSave);

		JButton btnNewQuery = new JButton(" New Query");
		btnNewQuery.setBackground(new Color(240, 255, 255));
		btnNewQuery.setToolTipText("New Query");
		btnNewQuery.setIcon(new ImageIcon(Tela.class
				.getResource(source + "New Query 16x16.png")));
		btnNewQuery.setPreferredSize(new Dimension(95, 21));
		btnNewQuery.addActionListener(action);
		this.add(btnNewQuery);
		btnNewQuery.setFont(new Font("Arial", Font.ITALIC, 12));

		JButton btnUndo = new JButton();
		btnUndo.setBackground(new Color(240, 255, 255));
		btnUndo.setToolTipText("Undo");
		btnUndo.setIcon(new ImageIcon(Tela.class.getResource(source
				+ "Undo 16x16.png")));
		btnUndo.setPreferredSize(new Dimension(42, 21));
		this.add(btnUndo);
		btnUndo.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				action.undo();

			}
		});

		JButton btnRedo = new JButton();
		btnRedo.setBackground(new Color(240, 255, 255));
		btnRedo.setToolTipText("Redo");
		btnRedo.setIcon(new ImageIcon(Tela.class.getResource(source
				+ "Redo 16x16.png")));
		btnRedo.setPreferredSize(new Dimension(42, 21));

		btnRedo.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				action.redo();
			}
		});

		this.add(btnRedo);

		JButton btnTranslate = new JButton(" Translate");
		btnTranslate.setBackground(new Color(240, 255, 255));
		btnTranslate.setToolTipText("Translate");
		btnTranslate.setIcon(new ImageIcon(Tela.class
				.getResource(source + "Execute 16x16.png")));
		btnTranslate.setPreferredSize(new Dimension(110, 21));
		btnTranslate.addActionListener(action);
		this.add(btnTranslate, BorderLayout.CENTER);
		btnTranslate.setFont(new Font("Arial", Font.ITALIC, 12));

		JButton btnExport = new JButton(" Export");
		btnExport.setBackground(new Color(240, 255, 255));
		btnExport.setToolTipText("Export");
		btnExport.setBackground(new Color(240, 255, 255));
		btnExport.setIcon(new ImageIcon(Tela.class
				.getResource(source + "Export 16x16.png")));
		btnExport.setPreferredSize(new Dimension(110, 21));
		btnExport.setFont(new Font("Arial", Font.ITALIC, 12));
		btnExport.addActionListener(action);
		this.add(btnExport);

		JButton btnClose = new JButton(" Close");
		btnClose.setBackground(new Color(240, 255, 255));
		btnClose.setToolTipText("Close");
		btnClose.setIcon(new ImageIcon(Tela.class
				.getResource(source + "close 16x16.png")));
		btnClose.setPreferredSize(new Dimension(110, 21));
		this.add(btnClose, BorderLayout.CENTER);
		btnClose.setFont(new Font("Arial", Font.ITALIC, 12));
		btnClose.addActionListener(action);

	}

}
